#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

compare(const void* x, const void* y)
{
	int countx = 1;
	int county = 1;
	int tmp = *(int*)y;
	while (tmp/10 != 0)
	{
		tmp /= 10;
		county++;
	}
	tmp = *(int*)x;
	while (tmp/10 != 0)
	{
		tmp /= 10;
		countx++;
	}
	if (*(int*)x *(int) pow(10,county) + *(int*)y > *(int*)y * (int)pow(10, countx) + *(int*)x)
		return -1;
	else
		return 1;

}

void itoa_ten(int  arr, char* str)
{
	int temp = arr;
	int count = 0;
	while (temp / 10 != 0)
	{
		temp /= 10;
		count++;
	}
	temp = arr;
	while (temp / 10 != 0)
	{
		str[count] = temp % 10+48;
		temp /= 10;
		count--;
	}
	str[count] = temp+48;
}

int main()
{
	int n = 0;
	scanf("%d", &n);
	int arr[20] = { 0 };
	int i = 0;
	for (i = 0;i < n;i++)
		scanf("%d", &arr[i]);
	qsort(arr, n, sizeof(int), compare);
	char str[500] = { 0 };
	char* temp = str;
	for(i=0;i<n;i++)
	{
		itoa_ten(arr[i], temp);
		while (*temp != '\0')
			temp++;
	}
	puts(str);
	return 0;
}